package com.house.order.controller;

import com.common.entity.order.Order;
import com.github.pagehelper.PageInfo;
import com.house.order.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: 温洁宇
 * @date: 2021/08/12/10:50
 * Other:
 */
@RestController
@RequestMapping("/order")
@CrossOrigin
public class OrderController {

    @Autowired
    private IOrderService orderService;

    /**
     * 获取订单列表
     */
    @PostMapping("/findAllPage")
    public PageInfo<Order> findAllPage(
            @RequestBody Order order,
            @RequestParam(value = "pageNum",defaultValue = "1") int pageNum,
            @RequestParam(value = "pageSize",defaultValue = "10") int pageSize
    ) {
        return orderService.findAllPage(order, pageNum, pageSize);
    }

    /**
     * 逻辑删除订单
     */
    @DeleteMapping("/del")
    public boolean del(Long id) {
        return orderService.del(id);
    }
}
